<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Title</title>
    <link href="/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/css/jquery.contextMenu.min.css" rel="stylesheet"/>
    <link href="/css/font-awesome.min.css" rel="stylesheet"/>
    <link href="/css/animate.css" rel="stylesheet"/>
    <link href="/css/style.css" rel="stylesheet"/>
    <link href="/css/skins.css" rel="stylesheet"/>
    <link href="/ruoyi/css/ry-ui.css?v=4.3.1" rel="stylesheet"/>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <!-- import Vue before Element -->
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
    <!-- import JavaScript -->
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <script src="/js/jquery.min.js"></script>
    <script> var ctx = "\/"; </script>
    <style type="text/css">
        html,body{
           background-color: #efeff4;
            padding: 0px;
            margin: 0px;
            font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
        }
        .head{
            width: 100%;
            height: 40px;
            background-color: #fff;
            color: #000;
            font-size: 14px;
            display:flex;
            display: -webkit-flex;
            -webkit-flex-direction:row;
            line-height: 40px;
        }
        .a,.c{
            width:22px;
            float: right;
            margin-right: 0px;
            margin-left: 2px;
        }
        .b {
            flex:1;
            text-align: center;
            font-size: 16px;
            font-weight: 400;
            line-height: 44px;
            white-space: nowrap;
            color: #000;
        }
        .arrow{
            line-height: 34px;
            ont-family: Muiicons;
            font-size: 24px;
            font-weight: 400;
            font-style: normal;
            display: inline-block;
            text-decoration: none;
            -webkit-font-smoothing: antialiased;
        }
        .el-timeline {
            padding-left: 35%;
            margin-top: 30px;
        }
        .el-timeline-item {
            height: 80px;
        }
        p{
            font-size: 16px;
        }
    </style>
</head>
<body>
    <div id="story">
        <div class="head">
            <div class="a" @click="goback"><span class="fa arrow"></span></div>
            <div class="b">审核进度栏</div>
            <div class="c"></div>
        </div>
        <p style="margin-top: 20px;text-align: center;font-size: 14px;">"小事说" 将在问题提交后的<span style="color: red">次工作日</span>与你联系。</p>
        <p style="margin-left: 30px;margin-right: 30px;margin-top: 20px;">
            <button type="button" class="btn btn-w-m btn-primary btn-block" @click="chatMessage">对话框</button>
        </p>
        <div class="block">
            <el-timeline>
                <el-timeline-item
                        v-for="(activity, index) in activities"
                        :key="index"
                        :icon="activity.icon"
                        :type="activity.type"
                        :color="activity.color"
                        :size="activity.size"
                        :timestamp="activity.timestamp"
                        v-if="activity.show">
                    {{activity.content}}
                </el-timeline-item>
            </el-timeline>
        </div>

    </div>
</body>

<script type="text/javascript">
    var content = new Vue({
        el: '#story',
        data: {
            activities: [{
                content: '开始',
                timestamp: '2018-04-12 20:46',
                size: 'large',
                type: 'primary',
                icon: 'el-icon-more',
                show: false
            },{
                content: '问题未受理',
                timestamp: '2018-04-12 20:46',
                type: 'primary',
                show: false
            },{
                content: '问题未审核',
                timestamp: '2018-04-12 20:46',
                size: 'large',
                type: 'primary',
                show: false
            }, {
                content: '已经移交其他部门处理',
                timestamp: '2018-04-03 20:46',
                type: 'primary',
                show: false
                // size: 'large'
            }, {
                content: '正在进行一次审核',
                timestamp: '2018-04-03 20:46',
                type: 'primary',
                show: false
                // size: 'large'
            }, {
                content: '正在进行二次审核',
                timestamp: '2018-04-03 20:46',
                type: 'primary',
                show: false
                // size: 'large'
            }, {
                content: '已完成',
                timestamp: '2018-04-03 20:46',
                type: 'primary',
                show: false
            }],

            storyId: window.location.href.split("?")[1].split("=")[1],
            handleState: 0
        },
        created(){
            this.handleState= [[${handleState}]]; //获得ModelMap的值
            this.storyId = [[${id}]];
            // alert(this.handleState);
            console.log(this.handleState);
            if (this.handleState === 0){
                // console.log(this.handleState);
                this.activities[0].show = "true";
                this.activities[1].color = "#0bbd87";
                this.activities[1].show = "true";
            }else {
                for (var i = 0; i <= this.handleState; i++){
                    console.log(i);
                    this.activities[i].color = "#0bbd87";
                    this.activities[i].show = "true";
                    if(i == 1) {
                        this.activities[1].content = "问题已受理";
                    }else if(i == 2) {
                        this.activities[2].content = "问题已审核";
                    }else if(i == 3) {
                        this.activities[3].content = "部门已经处理完毕";
                    }else if(i == 4) {
                        this.activities[4].content = "一次审核通过";
                    }else if(i == 5) {
                        this.activities[5].content = "二次审核通过";
                    }
                    this.activities[i].color = "##0bbd87";
                }
            }
            if(this.handleState < 5 ) {
                this.activities[this.handleState+1].color = "#0bbd87";
                this.activities[this.handleState+1].show = "true";
            }
            if(this.handleState == 5){
                this.activities[this.handleState+1].color = "##0bbd87";
                this.activities[this.handleState+1].show = "true";
            }
            this.benginTime();
        },
        methods: {
            goback: function() {
                window.history.back(-1);
            },
            chatMessage: function () {
                window.location.href="http://localhost:8081/story/chatAndroid?id="+this.storyId;
            },
            benginTime: function () {
                $.ajax({
                    url: ctx + "story/progress/storyInfo/" + this.storyId,
                    type: "post",
                    dataType: "json",
                    success: function (msg) {
                        content.activities[0].timestamp= msg.date;
                        // console.log(content.activities[0].timestamp);
                        // console.log(msg);
                    },
                    error: function (msg) {
                        console.log(msg);
                    }
                });
            }
        }
    });
</script>

</html>